﻿using System;
using System.Collections.Generic;
using System.Text;
using EZBarTender.DataAccess.DAO.EZBTTableAdapters;

namespace EZBarTender.DataAccess.Service
{
    public class ProductBatchService
    {
        private ProductBatchTableAdapter tableAdapter;

        public ProductBatchService(string connectionString)
        {
            tableAdapter = new ProductBatchTableAdapter();
            tableAdapter.Connection.ConnectionString = connectionString;
        }

        public DAO.EZBT.ProductBatchDataTable getAllByBatchNo(string batchNo, char printTagFlag, DateTime startDate, DateTime endDate, bool includeRehang)
        {
            if (includeRehang)
                return tableAdapter.GetDataByBatchNoModifiedWithRehang(batchNo, printTagFlag.ToString(), startDate, endDate);
            else
                return tableAdapter.GetByDataBatchNoModifiedNoRehangs(batchNo, printTagFlag.ToString(), startDate, endDate);
        }

        public DAO.EZBT.ProductBatchDataTable getAllByBatchNo(string batchNo, char printTagFlag, bool includeRehangs)
        {
            if (includeRehangs)
                return tableAdapter.GetDataByBatchNoWithRehangs(batchNo, printTagFlag.ToString());
            else
                return tableAdapter.GetDataByBatchNoNoRehangs(batchNo, printTagFlag.ToString());
        }
    }
}
